#include<iostream>
#include"apple.cpp"
using namespace std;

Apple::Apple(int i):apple_number(i){

}

int Apple::add(int num){
    cout<<"not const func"<<endl;
    take(num);
}
int Apple::add(int num) const{
    cout<<"const func"<<endl;
    take(num);
}
void Apple::take(int num) const{
    cout<<"take func "<<num<<endl;
}
int Apple::getCount() const{
    take(1);
    add(30); 
    return apple_number;
}
int main(){
    Apple a(2);
    cout<<a.getCount()<<endl;
    a.add(10);  //non const class call func doesn't have const
    cout<<"const class "<<endl;
    const Apple b(3);
    b.add(100); //const class call func have const
    cout<<b.getCount()<<endl;
    return 0;
}